#define _CRT_SECURE_NO_WARNINGS 1
#include"BTNode.h"





int main()
{
	//手动建二叉树
	BTNode* node1 = BuyNewNode(5);
	BTNode* node2 = BuyNewNode(7);
	BTNode* node3 = BuyNewNode(9);
	BTNode* node4 = BuyNewNode(4);
	BTNode* node5 = BuyNewNode(6);
	BTNode* node6 = BuyNewNode(2);
	BTNode* node7 = BuyNewNode(1);

	node1->left = node2;
	node2->left = node4;
	node1->right = node3;
	node3->left = node5;
	node3->right = node6;
	node6->left = node7;

	//前序 根左右
	PrevOrder(node1);
	printf("\n");
	//中序 左根右
	InOrder(node1);
	printf("\n");
	//后序 左右根
	PosOrder(node1);
	printf("\n");
	printf("size = %d\n", BinaryTreeSize(node1));
	//printf("size = %d", BinaryTreeSize(node1));
	printf("leafsize = %d\n", BinaryTreeLeafSize(node1));

	BTNode* find = BinaryTreeFind(node1, 90);
	if (find != NULL)
	{
		printf("找到了\n");
	}
	else
	{
		printf("没找到\n");
	}


	BinaryTreeDestory(node1);
	node1 = NULL;

	return 0;
}